package com.exam.controller;

import com.exam.entity.ApiResult;
import com.exam.entity.MultiQuestion;
import com.exam.serviceimpl.MultiQuestionServiceImpl;
import com.exam.util.ApiResultHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping(value = {"/multiquestioncontroller"})
public class MultiQuestionController {

    @Autowired
    private MultiQuestionServiceImpl multiQuestionService;

    @RequestMapping("/multiQuestionId")
    public ResponseEntity<MultiQuestion> findOnlyQuestion() {
        MultiQuestion res = multiQuestionService.findOnlyQuestionId();
        return new ResponseEntity<MultiQuestion>(res,HttpStatus.OK);
    }

    @PostMapping("/MultiQuestion")
    public ResponseEntity<Integer> add(@RequestBody MultiQuestion multiQuestion) {
        int res = multiQuestionService.add(multiQuestion);
        return new ResponseEntity<Integer>(res, HttpStatus.OK);
    }
}
